package com.mecuros.handler.handler;

import org.springframework.stereotype.Component;

import javax.persistence.criteria.CriteriaBuilder;
import java.util.HashMap;
import java.util.Map;

/**
 * @Classname HandlerHolder
 * @Description channel->Handler的映射关系
 * @Date 2022/5/15 6:40 下午
 * @Created by yujianbo
 */
@Component
public class HandlerHolder {

    private Map<Integer,Handler> handlers = new HashMap<>(128);

    public void putHandler(Integer channelCode, Handler handler) {
        handlers.put(channelCode, handler);
    }

    public Handler route(Integer channelCode) {
        return handlers.get(channelCode);
    }
}
